<?php

class Application_Form_Search extends Zend_Form {

    public function init() {
        $this->setMethod("post")
                ->setAttribs(array('class' => 'well'));

        #searchtype
        $searchOption = new Zend_Form_Element_Radio('searchOption');
        $searchOption->setLabel("Select search option")
                ->addMultiOptions(array(
                    'state' => 'Search by State & City',
                    'zip' => 'Search by Zipcode'
                ))
                ->removeDecorator('Label')
                ->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors',
                ))
                ->setSeparator('')
                ->setAttribs(array('float' => 'left'));

        #brands
        $brand = new Zend_Form_Element_Select('brand');
        $brand->setLabel("Choose your Brand")
                ->setRequired(true)
                ->setAttribs(array('required' => 'required', 'id' => 'form-brand'))
                ->addMultiOption('', "Choose your Brand")
                ->addValidator('Int')
                ->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors'
        ));

        #state        
        $state = new Zend_Form_Element_Select('state');
        $state->setLabel("Select State")
                ->addMultiOption('', "Select State")
                ->addValidator('Int')
                ->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors'
        ));

        #city
        $city = new Zend_Form_Element_Select('city');
        $city->setLabel("Select City")
                ->addMultiOption('', "Select City")
                ->addValidator('Int')
                ->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors'
        ));

        $zip = new Zend_Form_Element_Text('zip');
        $zip->setLabel("Enter Zipcode")
                ->setAttribs(array('placeholder' => 'Enter Zipcode'))
                ->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors'
        ));

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel("Search")
                ->setAttribs(array('class' => 'btn btn-success right'))
                ->setDecorators(array(
                    'ViewHelper',
                    'Description',
                    'Errors'
        ));

        $this->addElements(array($searchOption, $brand, $state, $city, $zip, $submit));
    }

}

